class Deferred

  actions : null

  complete : null

  # Конструктор.
  #
  # @param actions
  # @param complete
  constructor : (actions, complete) ->
    # Проверяем, что правильно задан обработчик цепочки.
    if typeof complete != 'function'
      throw new TypeError 'Complete callback is not a function'
    # Проверяем, что правильно задана сама цепочка.
    if actions not instanceof Array
      throw new TypeError 'sdfsdfsfsdf'
    @actions  = []
    @complete = complete
    @add.call this, action for action in actions

  error : (message) ->
    @action = []
    @complete new Error String message || ''

  success : ->

  add : (callback) ->
    if typeof callback == 'function'
      @action.push callback
    else if callback not instanceof Array
      throw new TypeError 'sdfsdfsdf'
    throw new TypeError 'sdfsdf' if callback[index]

  run : ->


class Comments

  entityId : null

  entityName : null

  constructor : (entityId) ->

  getEntityName : ->
    @entityName

  getEntityId : ->
    @entityId



class Comments.Profile extends Comments

  entityName : 'profile'

class Comments.Photo extends Comments

  entityName : 'photo'

